package abstract1;

public abstract class Isosceles extends Shape {
    private int size;
    Isosceles(int size){
        setSize(size);
    }
    public int getSize(){
        return size;
    }
    public void setSize(int size){
        this.size=size;
    }
    public String toString(){
        return "等腰直角三角形,边长是："+size;
    }



}
//-----------------------------------
class LeftDown extends Isosceles{


    LeftDown(int size){
        super(size);
    }

    public void draw(){
        for (int i = 1; i <=getSize() ; i++) {
            for (int j = 1; j <=i ; j++) {
                System.out.print("* ");
            }
            System.out.println();
        }
    }
    public String toString(){
        return "等腰直角三角形,边长是："+getSize()+" 此直角是在左下方！";
    }
}

//---------------------------------------------------------
class LeftUp extends Isosceles{


    LeftUp(int size){
        super(size);
    }

    public void draw(){
        for (int i = 0; i <getSize() ; i++) {
            for (int j = 0; j <getSize()-i; j++) {
                System.out.print("* ");
            }
            System.out.println();
        }
    }
    public String toString(){
        return "等腰直角三角形,边长是："+getSize()+" 此直角是在左上方！";
    }

}
//--------------------------------------------------------------
class Rightup extends Isosceles {
    private int size;

    Rightup(int size) {
        super(size);
    }

    @Override
    public String toString() {
        return "等腰直角三角形,边长是：" + getSize() + " 此直角是在右上方！";
    }

    @Override
    public void draw() {
        for (int i = 0; i < getSize(); i++) {
            for (int j = 0; j < getSize(); j++) {
                if (j>=i)
                    System.out.print("* ");
                else
                    System.out.print("  ");


            }System.out.println();
        }
    }
}
//----------------------------------------------------------------
class RightDown extends Isosceles{

    RightDown(int size) {
        super(size);
    }

    @Override
    public void draw() {
        for (int i = 0; i < getSize(); i++) {
            for (int j = 0; j < getSize(); j++) {
                if (i + j >= getSize() - 1)
                    System.out.print("* ");
                else
                    System.out.print("  ");
            }
            System.out.println();
        }

    }

    public String toString() {
        return "等腰直角三角形,边长是：" + getSize() + " 此直角是在右下方！";
    }

}
//------------------------------------------------------------------